﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

[ServiceContract(Namespace = "http://BizTalkFlowVisualizer.Services/FlowData")]

public interface IFlowData
{
    [OperationContract]
    [WebGet(UriTemplate = "getFlowData/{startDate}/{endDate}/{timezoneOffset}",
        RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
    // e.g. http://localhost:65390/FlowData.svc/JSON/getFlowData
    VisualizationData GetFlowData(string startDate, string endDate, string timezoneOffset);
}

[DataContract]
public class VisualizationData
{
    [DataMember]
    public PortData[] ports { get; set; }
    [DataMember]
    public OrchStepData[] orchSteps { get; set; }
    [DataMember]
    public LinkData[] links { get; set; }
    [DataMember]
    public DisplayOrder[] displayOrder { get; set; }
}

[DataContract]
public class PortData
{
    [DataMember]
    public int AvgMilliSeconds { get; set; }
    [DataMember]
    public int ErrorMessageCount { get; set; }
    [DataMember]
    public string ShapeID { get; set; }
    [DataMember]
    public string PortName { get; set; }
    [DataMember]
    public string PortType { get; set; }
    [DataMember]
    public int ReceiveMessageCount { get; set; }
}

[DataContract]
public class OrchStepData
{
    [DataMember]
    public int ErrorCount { get; set; }
    [DataMember]
    public int LineNumber { get; set; }
    [DataMember]
    public int MessageCount { get; set; }
    [DataMember]
    public string OrchID { get; set; }
    [DataMember]
    public string OrchName { get; set; }
    [DataMember]
    public string StepID { get; set; }
    [DataMember]
    public string StepName { get; set; }
}

[DataContract]
public class LinkData
{
    [DataMember]
    public int AvgMilliSeconds { get; set; }
    [DataMember]
    public string FromShapeID { get; set; }
    [DataMember]
    public string LinkType { get; set; }
    [DataMember]
    public int MessageCount { get; set; }
    [DataMember]
    public string ToShapeID { get; set; }
    [DataMember]
    public string FromType { get; set; }
    [DataMember]
    public string ToType { get; set; }
}

[DataContract]
public class DisplayOrder
{
    [DataMember]
    public string ID { get; set; }
    [DataMember]
    public string Type { get; set; }
    [DataMember]
    public int OrderIndex { get; set; }
}